/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React from 'react';
import { Button, Popconfirm, Space, Typography } from 'antd';
import { upTxtMap, userLevel } from '../_utils';

const { Title } = Typography;

const AuditTitle: React.FC<any> = (props) => {
  const { record, handleUpdate } = props;

  const { cm_phone, brand, user_type } = record;
  const platform = brand === 'dak' ? '驿站' : '快递员';
  return (
    <Space>
      <Title level={5} style={{ margin: 0 }}>
        {cm_phone}
      </Title>
      <Title level={5} style={{ margin: 0 }}>
        {platform}
      </Title>
      <Title level={5} style={{ margin: 0 }}>
        {userLevel[user_type]}
      </Title>
      {['untrusted', 'normal'].includes(user_type) && (
        <Popconfirm title={upTxtMap[user_type]} onConfirm={handleUpdate.bind(null, record)}>
          <Button size='small' type='primary'>
            升级
          </Button>
        </Popconfirm>
      )}
    </Space>
  );
};

export default AuditTitle;
